package cn.tedu_01;

import sun.java2d.pipe.SpanIterator;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;

public class FileTest_01 {
    public static void main(String[] args) throws IOException {
      File f=new File("F:\\baby\\测试1.txt");
        System.out.println(f.length());
        System.out.println(f.exists());
        System.out.println(f.isFile());
        System.out.println(f.isDirectory());
        System.out.println(f.getName());
        System.out.println(f.getParent());
        System.out.println(f.getAbsoluteFile());
        System.out.println(f.canExecute());
        System.out.println(f.canRead());


        f=new File("F:\\baby\\测试2.txt");
        System.out.println(f.createNewFile());

        f= new File("F:\\baby\\美好");
        System.out.println(f.mkdir());

        f=new File("F:\\baby\\a\\b\\c");
        System.out.println(f.mkdirs());

        f=new File("F:\\baby\\测试2.txt");
        System.out.println(f.delete());

        f =new File("F:\\baby");
       String [] s = f.list();
        System.out.println(Arrays.toString(s));//[a, 测试1.txt, 美好]

        File [] fs=f.listFiles();
        System.out.println(Arrays.toString(fs));//[F:\baby\a, F:\baby\测试1.txt, F:\baby\美好]





    }
}
